<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
            "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="hevea 1.08">
<LINK rel="stylesheet" type="text/css" href="umsroot.css">
<TITLE>
Heuristic Program Checker
</TITLE>
</HEAD>
<BODY >
<A HREF="umsroot084.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot083.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot086.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
<HR>

<H2 CLASS="section"><A NAME="htoc207">15.2</A>&nbsp;&nbsp;Heuristic Program Checker</H2>

The Heuristic Program Checking tool generates warning messages for 
dubious programming constructs and violation of naming conventions for 
an ECLiPSe source module or file. It is loaded as follows:
<BLOCKQUOTE CLASS="quote">
<PRE CLASS="verbatim">
:- lib(lint).
</PRE></BLOCKQUOTE>
The heuristic rules currently enforced are based on the style guide of
Appendix <A HREF="umsroot153.html#styleguide">E</A>. These rules are somewhat limited in scope. The library 
is distributed as source and serves to provide a framework for the 
addition of a more comprehensive set of rules that are tailored to each
individual developer.<BR>
<BR>
Consider the following typographic mistakes in the <B>n-queens</B> 
example:
<BLOCKQUOTE CLASS="quote">
<PRE CLASS="verbatim">
queen(Data, Out) :-
        qperm(Datas, Out),
        safe(Out).

n0diag([], _, _).
</PRE></BLOCKQUOTE>
The tool is invoked using the
<A HREF="../bips/lib/lint/lint-1.html"><B>lint/1</B></A><A NAME="@default870"></A> predicate with the source
file specified as an atom or string:
<BLOCKQUOTE CLASS="quote">
<PRE CLASS="verbatim">
?- lint(queen).
 
--- File /tmp/queen.ecl, line 4:
Singleton variables: [Data, Datas]
 
--- File /tmp/queen.ecl, line 22:
Questionable predicate name: n0diag
 
Yes (0.01s cpu)
</PRE></BLOCKQUOTE>
The checker identifies <TT>Data</TT> and <TT>Datas</TT> as being singleton variables
and is dubious of the <TT>n0diag</TT> predicate name. Both are the result of 
programmer error, <TT>Datas</TT> should read <TT>Data</TT> and <TT>n0diag</TT> 
as <TT>nodiag</TT>. The <A HREF="../bips/lib/lint/lint-2.html"><B>lint/2</B></A><A NAME="@default871"></A> 
predicate allows a list of options to be specified that turn on 
and off the heuristic rules.<BR>
<BR>
<HR>
<A HREF="umsroot084.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
<A HREF="umsroot083.html"><IMG SRC ="contents_motif.gif" ALT="Up"></A>
<A HREF="umsroot086.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
</BODY>
</HTML>
